import asyncio


async def coroutine_task(author, book):  # 任务处理函数
    for item in range(5):  # 循环执行
        print(f"【{asyncio.current_task().get_name()}】图书作者：{author}, book:《{book}》")
        await asyncio.sleep(1)  # 延迟1秒执行


async def corutine_start():  # 协程启动
    tasks = [
        asyncio.create_task(coroutine_task("韩朵朵", "Python开发实战"), name="Handuoduo - Python"),
        asyncio.create_task(coroutine_task("韩朵朵", "Java开发实战"), name="Handuoduo - Java"),
        asyncio.create_task(coroutine_task("韩朵朵", "Matlab开发实战"), name="Handuoduo - Matlab"),
        asyncio.create_task(coroutine_task("韩朵朵", "Go开发实战"), name="Handuoduo - Go"),
        asyncio.create_task(coroutine_task("韩朵朵", "Mysql开发实战"), name="Handuoduo - MySQL")
    ]
    # 启动协程任务列表
    await asyncio.gather(*tasks)


def main():
    asyncio.run(corutine_start())  # 协程启动


if __name__ == '__main__':
    main()
